﻿using System;

namespace KL.UFrame.Data.DynamicLinqExtension
{
    public class Filter
    {
        public Filter(string key, string value, FilterCantract contract)
        {
            if(string.IsNullOrEmpty(key)) throw new ArgumentNullException(nameof(key));
            if (string.IsNullOrEmpty(value)) throw new ArgumentNullException(nameof(value));
            Key = key;
            Value = value;
            Contract = contract;
        }
        /// <summary>
        /// 过滤的关键字，如：表的字段名
        /// </summary>
        public string Key { get; set; }

        /// <summary>
        /// 过滤的值
        /// </summary>
        public string Value { get; set; }

        /// <summary>
        /// 过滤的约束
        /// </summary>
        public FilterCantract Contract { get; set; }
    }

    public enum FilterCantract
    {
        LessThan,
        LessThanOrEqual,
        GreaterThan,
        GreaterThanOrEqual,
        Like,
        Equal,
        NotEqual
    }
}